<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output method="html" encoding="iso-8859-1" indent="no"/>
 <xsl:param name="scriptname"/>
 <xsl:template match="xicshelp">
   <html>
   <head>
       <title>XICS Hilfe: <xsl:value-of select="title"/></title>
       <style type="text/css">
           h1 {background-color: #E0F6FD; border: 1px solid grey; width: 96%; padding:3px; border-bottom:4px solid grey; border-right:4px solid grey}
           h2 {background-color: #E0F6FD; border: 1px solid grey; width: 96%; padding:3px; border-bottom:4px solid grey; border-right:4px solid grey}
           h3 {background-color: #E0F6FD; border: 1px solid grey; width: 95%; padding:2px; border-bottom:3px solid grey; border-right:3px solid grey}
           div.textcontent {display: block; margin-left: 2%; width: 92%}
           div.image {border: 1px solid black; padding: 10px; margin: 10px; background-color: #E0F6FD}
           table {margin-top: 20px; margin-bottom: 20px;}
       </style>
   </head>
   <body>
    <h1><a name="top">XICS Hilfe:</a> <xsl:value-of select="title"/></h1>
    <xsl:choose>
        <xsl:when test="count(chapter) &gt; 0 and count(toc) = 0">
            <h2>Kapitel in diesem Dokument</h2>
            <xsl:for-each select="chapter">
            	<xsl:variable name="chname" select="name"/>
            	<a href="#{$chname}"><xsl:number value="position()" format="1. "/> <xsl:value-of select="title"/></a><br/>
            </xsl:for-each>
            <xsl:for-each select="chapter">
                <xsl:variable name="chname" select="name"/>
                <h3><xsl:number value="position()" format="1. "/> <a name="{$chname}"><xsl:value-of select="title"/></a></h3>
                <a href="#top">ganz nach oben</a><br/>
                <xsl:variable name="chcount" select="position()"/>
                <xsl:if test="count(content/par) &gt; 1">
                   <br/>
		            <strong>Paragraphen im Kapitel &quot;<xsl:value-of select="title"/>&quot;</strong><br/>
                   <xsl:for-each select="content/par">
                        <xsl:variable name="parname" select="name"/>
                        <a href="#{$chname}{$parname}"><xsl:value-of select="$chcount"/>.<xsl:number value="position()" format="1. "/> <xsl:value-of select="title"/></a><br/>
                    </xsl:for-each>
                </xsl:if>
                <xsl:for-each select="content/par">
                    <xsl:variable name="parname" select="name"/>
                    <h4><xsl:value-of select="$chcount"/>.<xsl:number value="position()" format="1. "/> <a name="{$chname}{$parname}"><xsl:value-of select="title"/></a></h4>
                    <div class="textcontent">
                        <xsl:apply-templates select="text"/>
                    </div>
                    <br/>
                    <a href="#{$chname}">nach oben</a>
                </xsl:for-each>
            </xsl:for-each>
        </xsl:when>
        <xsl:when test="count(chapter) = 0 and count(toc) &gt; 0">
            <xsl:for-each select="toc">
                <h2><xsl:value-of select="title"/></h2>
                <ul>
                <xsl:for-each select="entry">
                    <xsl:variable name="entryref" select="@ref"/>
                    <li><a href="{$scriptname}/help/show/{$entryref}"><xsl:value-of select="text()"/></a></li>
                </xsl:for-each>
                </ul>
            </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
            You can not have chapters and tocs in the same document.
        </xsl:otherwise>
    </xsl:choose>
    </body>
    </html>
 </xsl:template>
 <xsl:include href="helpCommon.xsl"/>
</xsl:stylesheet>